<script>
export default {
  onLaunch: function() {
    console.log('App Launch')
    
    // 检查登录状态
    const token = uni.getStorageSync('token')
    const userInfo = uni.getStorageSync('userInfo')
    
    if (token && userInfo) {
      // 已登录，根据角色跳转到对应页面
      const routes = {
        student: '/pages/student/schedule/schedule',
        teacher: '/pages/teacher/course/course',
        admin: '/pages/admin/dashboard/dashboard'
      }
      
      uni.reLaunch({ url: routes[userInfo.role] })
    } else {
      // 未登录，跳转到登录页
      uni.reLaunch({ url: '/pages/login/login' })
    }
  },
  onShow: function() {
    console.log('App Show')
  },
  onHide: function() {
    console.log('App Hide')
  }
}
</script>

<style lang="scss">
@import "uview-plus/index.scss";
/* 全局样式 */
page {
  background-color: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, sans-serif;
}

/* 统一按钮样式 */
button {
  border-radius: 8rpx;
}

/* 统一输入框样式 */
input, textarea {
  border-radius: 8rpx;
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 0;
  height: 0;
  color: transparent;
}
</style>